#ifndef __LSB_EMBEDDING_ENGINE_H__
#define __LSB_EMBEDDING_ENGINE_H__ 1

#include "embedding_engine.h"

#include "types.h"

/**
 * @brief implementation of the LSB embedding algorithm.
 * @author gpitsch and rpoisel
 */
class CLSBEmbeddingEngine : public IEmbeddingEngine
{
public:

	/**
	 * @param pBitSource data source/sink for stego payload
	 */
	CLSBEmbeddingEngine(IBitSource* pBitSource);
	virtual ~CLSBEmbeddingEngine();

	virtual std::string getIniSectionName() const;

	// samples of types s8, u8, s16 and u16 are supported by the lsb embedding
	// engine

	virtual int embedIntoSamples(int8_t* pSamples, unsigned int pCount, unsigned int pLeak);
	virtual int embedIntoSamples(uint8_t* pSamples, unsigned int pCount, unsigned int pLeak);
	virtual int embedIntoSamples(int16_t* pSamples, unsigned int pCount, unsigned int pLeak);
	virtual int embedIntoSamples(uint16_t* pSamples, unsigned int pCount, unsigned int pLeak);
	virtual int embedIntoSamples(double* pSamples, unsigned int pCount, unsigned int pLeak) { return -1; }

	virtual int extractFromSamples(int8_t* pSamples, unsigned int pCount, unsigned int pLeak, unsigned int pInBuffer);
	virtual int extractFromSamples(uint8_t* pSamples, unsigned int pCount, unsigned int pLeak, unsigned int pInBuffer);
	virtual int extractFromSamples(int16_t* pSamples, unsigned int pCount, unsigned int pLeak, unsigned int pInBuffer);
	virtual int extractFromSamples(uint16_t* pSamples, unsigned int pCount, unsigned int pLeak, unsigned int pInBuffer);
	virtual int extractFromSamples(double* pSamples, unsigned int pCount, unsigned int pLeak, unsigned int pInBuffer) { return -1; }

	virtual void shutdown() { }

	inline virtual int changeSettings() { return 0; }
	inline virtual int getNumRequiredSamples() { return sNumRequiredSamples; }
	inline virtual NAudioFormats::ESamplesFormat getSamplesFormat() { return sSamplesFormat; }

protected:
	static const int sNumRequiredSamples;
	static const NAudioFormats::ESamplesFormat sSamplesFormat;

private:
	CLSBEmbeddingEngine(const CLSBEmbeddingEngine& );
	CLSBEmbeddingEngine& operator=(const CLSBEmbeddingEngine& );

	static const std::string sIniSectionName;

	IBitSource* mBitSource;
};

#endif // __LSB_EMBEDDING_ENGINE_H__

